19 #include "simpletools.h" 22 char _sdi, _dc, _clk, _rst;
25 screen_t *il3820_init(
char sdi,
char sclk,
char cs,
char rs,
char rst,
char busy,
int _width,
int _height) {
27 screen_t* dev = (screen_t*) malloc(
sizeof(screen_t));
28 memset(dev, 0,
sizeof(screen_t));
30 unsigned char* _image = (
char*) malloc(_width * ((_height + 7) >> 3));
31 memset(_image, 0xff, (_width * ((_height + 7) >> 3)));
35 dev->image_ptr = _image;
36 dev->image_size = (_width * ((_height + 7) >> 3));
44 dev->status_pin = busy;
47 dev->height = _height;
50 dev->text_color = BLACK;
51 dev->bg_color = BLACK;
54 dev->deviceDrawPixel = il3820_drawPixel;
55 dev->deviceDrawFastHLine = il3820_drawFastHLine;
56 dev->deviceDrawFastVLine = il3820_drawFastVLine;
58 dev->deviceInterface = INTF_SPI_WITH_BUFFER;
60 dev->deviceClearDisplay = il3820_clearDisplay;
61 dev->deviceUpdateDisplay = il3820_updateDisplay;
62 dev->deviceResetDisplay = il3820_resetDisplay;
64 i2c *eeBus = i2c_newbus(28, 29, 0);
65 loadFonts(dev, eeBus);
69 set_direction(rst, 1);
71 set_direction(sdi, 1);
72 set_direction(sclk, 1);
73 set_direction(busy, 0);
75 il3820_resetDisplay(dev);
76 il3820_clearDisplay(dev);
77 il3820_updateDisplay(dev);